<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout/default}">
<head>
    <title>合同详情</title>
</head>
<body>
    <div layout:fragment="content">
        <div class="d-flex justify-content-between align-items-center mb-3">
            <h1>合同详情</h1>
            <div>
                <a th:href="@{/contract/edit/{id}(id=${contract.id})}" class="btn btn-primary">编辑</a>
                <a th:href="@{/contract/list}" class="btn btn-secondary ml-2">返回列表</a>
            </div>
        </div>
        
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>合同编号</label>
                            <p class="form-control-static" th:text="${contract.contractNo}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>合同名称</label>
                            <p class="form-control-static" th:text="${contract.name}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>客户名称</label>
                            <p class="form-control-static" th:text="${contract.customerName}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>销售机会</label>
                            <p class="form-control-static" th:text="${contract.opportunityName}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>合同金额</label>
                            <p class="form-control-static" th:text="${'¥' + contract.amount}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>签约日期</label>
                            <p class="form-control-static" th:text="${contract.signDate}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>到期日期</label>
                            <p class="form-control-static" th:text="${contract.endDate}">-</p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>合同状态</label>
                            <p class="form-control-static">
                                <span th:class="${'badge ' + (contract.status == 3 ? 'badge-success' : (contract.status == 4 ? 'badge-danger' : (contract.status == 2 ? 'badge-primary' : (contract.status == 1 ? 'badge-info' : 'badge-secondary'))))}" 
                                      th:switch="${contract.status}">
                                    <span th:case="0">草稿</span>
                                    <span th:case="1">审核中</span>
                                    <span th:case="2">执行中</span>
                                    <span th:case="3">完成</span>
                                    <span th:case="4">取消</span>
                                    <span th:case="*">未知状态</span>
                                </span>
                            </p>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <label>合同内容</label>
                            <p class="form-control-static" th:text="${contract.content}">-</p>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <label>备注</label>
                            <p class="form-control-static" th:text="${contract.remark}">-</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html> 